#include <bits/stdc++.h>

using namespace std;

int main_111()
{
    srand((unsigned int)time(nullptr));
    int n1=15,n2=20;
    int arr1[n1],arr2[n2],arr3[n1+n2];
    memset(arr1,0,n1);
    memset(arr2,0,n2);
    memset(arr3,0,n1+n2);
    for (int i=0; i<n1 ; ++i )
    {
        arr1[i]=rand()%n1;
    }
    for (int i=0; i<n2 ; ++i )
    {
        arr2[i]=rand()%n2;
    }
    sort(arr1,arr1+n1);
    sort(arr2,arr2+n2);
    for (int i=0; i<n1 ; ++i )
    {
        printf("%d ",arr1[i]);
    }
    printf("\n");
    for (int i=0; i<n2 ; ++i )
    {
        printf("%d ",arr2[i]);
    }
    printf("\n");
    int i=0,j=0,index=0;
    while (i<n1&&j<n2)
    {
        if (arr1[i]<=arr2[j])
        {
            arr3[index++]=arr1[i++];
        }
        else
        {
            arr3[index++]=arr2[j++];
        }
    }
    while (i<n1)
    {
        arr3[index++]=arr1[i++];
    }
    while (j<n2)
    {
        arr3[index++]=arr2[j++];
    }
    for (int k=0;k<(n1+n2) ;++k )
    {
        printf("%d ",arr3[k]);
    }
    return 0;
}
